package com.gly091020.ohMyPC;

import com.mojang.logging.LogUtils;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforge.client.event.ClientTickEvent;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
import org.slf4j.Logger;

import java.util.UUID;

@Mod(value = OhMyPC.ModID, dist = Dist.CLIENT)
public class OhMyPC {
    public static final String ModID = "oh_my_pccccccccc";
    public static final Logger LOGGER = LogUtils.getLogger();
    public static final UUID _5112151111121 = UUID.fromString("91bd580f-5f17-4e30-872f-2e480dd9a220");
    public static OhMyPCConfig CONFIG;

    public OhMyPC(ModContainer container){
        AutoConfig.register(OhMyPCConfig.class, Toml4jConfigSerializer::new);
        container.registerExtensionPoint(IConfigScreenFactory.class, (mc, parent) ->
                OhMyPCConfig.getConfigScreen(parent));
        CONFIG = AutoConfig.getConfigHolder(OhMyPCConfig.class).getConfig();
        PCTimerInit.start();
        SoundLoader.SOUND = FMLPaths.CONFIGDIR.get().resolve("oh_my_pc").resolve(OhMyPC.CONFIG.sound);
        SoundLoader.init();
    }

    @EventBusSubscriber(modid = OhMyPC.ModID, value = Dist.CLIENT)
    public static class EventHandler {
        @SubscribeEvent
        public static void onClientTick(ClientTickEvent.Post event) {
            PCTimerInit.reset();
        }
    }
}
